Ubuntu设置笔记本合上盖子不休眠

在默认情况下,笔记本合上屏幕后,ubuntu系统会休眠,但是通过更改配置可以使笔记本合上盖子不进去休眠,方法如下:
修改 Login Manager的配置文件。
打开终端:

1
sudo vim /etc/systemd/logind.conf

然后将其中的:

1
#HandleLidSwitch=suspend

改成:

1
HandleLidSwitch=ignore

logind.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See logind.conf(5) for details.

[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
HandleLidSwitch=ignore
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192

然后重启服务:

1
service systemd-logind restart

或者

1
sudo restart systemd-logind

或者直接重启

1
sudo shutdown -r now

即可使设置生效。

继开 wechat
欢迎加我的微信,共同交流技术